/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DAO;

import Entities.User;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class UserDAO implements IUserDAO {
    private List<User> userList;

    public UserDAO() {
        userList = new ArrayList<User>() {};
        addUser();
    }

    public void addUser(){
        userList.add(new User("hanhnguyen", "12345678", "admin"));
        userList.add(new User("longhoang", "12345678", "user"));
        userList.add(new User("hungnguyen", "12345678", "admin"));
    }

    public User getUser(String username, String password){
        for(User user : userList){
            if(user.getUsername().equals(username) &&
                    user.getPassword().equals(password))
                return user;
        }
        return null;
    }
}
